IF OBJECT_ID('ssf.ptx_parse_task_description_task_group_run_id') IS NOT NULL
	DROP FUNCTION ssf.ptx_parse_task_description_task_group_run_id
GO

CREATE FUNCTION ssf.ptx_parse_task_description_task_group_run_id (
	@task_description NVARCHAR(4000)
)
RETURNS NVARCHAR(256)
AS
BEGIN
/*
<object_header>

<object_summary>
	<purpose><![CDATA[

	]]></purpose>
</object_summary>

</object_header>
*/

	RETURN (
		CASE WHEN @task_description LIKE N'(_%),(_%),(_%),(_%):%'
			THEN SUBSTRING(@task_description, 1, CHARINDEX('):', @task_description))
			ELSE NULL
			END
	)
END
GO
